package org.association.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.association.entity.OrganizationEntity;
import org.association.entity.VoteRecord;

import java.util.ArrayList;

public interface VoteRecordDao extends BaseMapper<VoteRecord> {

    @Select(
        "select distinct user_id from vote_record where proposal_id = #{proposal_id} and statu = #{statu}"
    )
    ArrayList<String> getAgreePeopleByProposalId(@Param("proposal_id") String proposal_id, @Param("statu") int statu);

    @Select(
            "select * from vote_record where proposal_id = #{proposalID} and user_id = #{userID}"
    )
    VoteRecord getVoteRecordById(@Param("proposalID")String proposalID, @Param("userID")String userID);
}
